//
//  model.m
//  SlideViewTest
//
//  Created by 海明洋 on 14-11-24.
//  Copyright (c) 2014年 Nancy. All rights reserved.
//

#import "model.h"
#import "Left_1_ViewController.h"
#import "Right_1_ViewController.h"
#import "IIViewDeckController.h"
#import "searchViewController.h"
@implementation model
static model *_shareModel;
static UINavigationController *_main;
static collectionViewController *_collection;
static searchViewController *_search;
static UITableView *_tableView;
static UIScrollView *_scrollView;
static UIImageView *_selectedView;

+ (model *)shareModel
{
    @synchronized(self){
        if (!_shareModel) {
            _shareModel=[[self alloc]init];
        }
    }
    return _shareModel;
}

+ (UINavigationController *)shareMain
{
    @synchronized(self){
        if (!_main) {
            ViewController *main=[[ViewController alloc] init];
            _main=[[UINavigationController alloc] initWithRootViewController:main];
        }
    }
    return _main;
}

+ (collectionViewController *)shareCollection
{
    @synchronized(self){
        if (!_collection) {
            _collection=[[collectionViewController alloc] init];
        }
    }
    
    return _collection;
}

+ (searchViewController *)shareSearch
{
    @synchronized(self){
        if (!_search) {
            _search=[[searchViewController alloc] init];
        }
    }
    
    return _search;
}

+ (UITableView *)shareTableView
{
    @synchronized(self){
        if (!_tableView) {
            _tableView=[[UITableView alloc] init];
        }
    }
    
    return _tableView;
}

+ (UIScrollView *)shareScrollView
{
    @synchronized(self){
        if (!_scrollView) {
            _scrollView=[[UIScrollView alloc] init];
        }
    }
    
    return _scrollView;
}

+ (UIImageView *)shareSelectedView
{
    @synchronized(self){
        if (!_selectedView) {
            _selectedView=[[UIImageView alloc] init];
        }
    }
    
    return _selectedView;
}

-(id)init
{
    self=[super init];
    if (self) {
        self.left=NO;
        self.right=NO;
        self.row=2;
        self.advArr=[[NSMutableArray alloc] init];
        self.backHome=NO;
        self.collectionDataArr=[[NSMutableArray alloc] init];
        self.searchSelect=NO;
    }
    return self;
}
@end
